﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Guru.Web.UI;
using Guru.Web.Controls.Telerik;

[PageTextResource("HotelFilteringOptions")]
public partial class UserControl_HotelFiltering : GuruUserControl
{
   
    public event EventHandler HotelFiltered;

    protected void Page_Init(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.uxRoomStatus.BindComboBox(HSMConstants.RefType.RoomStatus, true);
            this.uxRoomType.BindComboBox(HSMConstants.RefType.RoomType, true);
            this.uxFromDate.SelectedDate = DateTime.Now;
            this.uxFromDate.MinDate = DateTime.Now;            
        }
    }

    protected void uxSearch_Click(object sender, EventArgs e)
    {
        if (uxFromDate.SelectedDate == null) return;

        HSMSessionManager.HotelFilterOptions.ViewDate = uxFromDate.SelectedDate.Value;
        HSMSessionManager.HotelFilterOptions.RoomStatus = uxRoomStatus.SelectedValue;
        HSMSessionManager.HotelFilterOptions.RoomType = uxRoomType.SelectedValue;

        if (this.HotelFiltered != null)
        {
            this.HotelFiltered(this, e);
        }
    }
    protected void uxClear_Click(object sender, EventArgs e)
    {
        uxFromDate.SelectedDate = DateTime.Now;
        uxRoomStatus.SelectedIndex = uxRoomType.SelectedIndex = 0;
    }
    
    
}
